<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/2/27s
  Time: 19:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.model.Guestbook" %>
<%
    String path = request.getContextPath();
%>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改留言信息</title>
    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="CLEditor1_3_0/jquery.cleditor.css">
    <script src="CLEditor1_3_0/jquery.min.js"></script>
    <script src="CLEditor1_3_0/jquery.cleditor.js"></script>
    <script>
        $(function(){
            //初始化cleditor插件
            $("#input").cleditor();
        })
    </script>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
</head>
<body>
<div class="container">
    <form class="form-horizontal" method="post" action="user/add">
        <fieldset>
            <legend>
                <h1>修改留言的信息</h1>
            </legend>
            <%--如何才能获取到保存在服务器端的list集合--%>
            <%
                //request.getAttribute("list");获取保存在服务器端的数据
                //request.getAttribute("list");根据key值就可以获取到对应的value

                List<Object> list = (List<Object>)request.getAttribute("updatelist");
                for(int i = 0;i<list.size();i++){
                    Guestbook gb = (Guestbook) list.get(i);
            %>
            <div class="form-group">
                <label for="inputName3" class="col-md-4 control-label">姓名:</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" id="inputName3" placeholder=<%=gb.getName()%> name="name">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPhone3" class="col-md-4 control-label">电话号码:</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" id="inputPhone3" placeholder=<%=gb.getPhone()%> name="phone">
                </div>
            </div>

            <div class="form-group">
                <label for="inputEmail3" class="col-md-4 control-label">电子邮箱:</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" id="inputEmail3" placeholder=<%=gb.getEmail()%> name="email">
                </div>
            </div>

            <div class="form-group">
                <label for="inputTitle3" class="col-md-4 control-label">标题:</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" id="inputTitle3" placeholder=<%=gb.getTitle()%> name="title">
                </div>
            </div>

            <div class="form-group">
                <label class="col-md-4 control-label">内容:</label>
                <div class="col-md-4">
                    <textarea class="form-control" name="content" id="input" cols="25" rows="10"></textarea>
                </div>
            </div>

            <div class="form-group" align="center">
                <a class="btn btn-primary" href="<%=path%>/user/manager?id=<%=gb.getId()%>&q=update">确定</a>
                <a class="btn btn-danger" href="<%=path%>/user/manager?id=<%=gb.getId()%>&q=list">取消</a>
            </div>
            <%
                }
            %>
            <legend align="center"></legend>

        </fieldset>

    </form>
</div>

</body>
</html>
